<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );

	echo( form_open(base_url() . 'swamivisits/event_registration/step1_process/'. $eventid . '/', array('id' => 'registerEventForm1') ) );

		Spacer::Render(0, 20);
		echo('<hr />');
		Form::OpenFormItem('First Name*:', 260);
			echo( form_input(array('name'=>'firstname','id'=>'firstname','maxlength'=>'16','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Last Name*:', 260);
			echo( form_input(array('name'=>'lastname','id'=>'lastname','maxlength'=>'16','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Email*:', 260);
			echo( form_input(array('name'=>'email','id'=>'email','maxlength'=>'127','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Re-enter Email*:', 260);
			echo( form_input(array('name'=>'emailConfirm','id'=>'emailConfirm','maxlength'=>'127','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Number of participants*:</br><font size="2" color="red">($5 per participant registration fee)</font>', 260);
			$npoptions = array(''=>'Select','1'=>'1', '2'=>'2', '3'=>'3', '4'=>'4', '5'=>'5', '6'=>'6', '7'=>'7', '8'=>'8', '9'=>'9', '10'=>'10');
			echo( form_dropdown('numreg', $npoptions, '', 'id="numreg" style="width: 75px;" onchange="numParticipantsHandler();"') );			
		Form::CloseFormItem();
		Spacer::Render(0, 20);

		echo('<div>');
		echo('<b>Total Registration Fee: $<span id="totamount"> </span></b>');
		echo('</div>');
		
		Spacer::Render(0, 20);
		echo('<hr />');
		echo('<font size="2" color="red">You are finishing the first step of registration to collect all relevant information. To complete your registration you must click the <u>Make Payment</u> button to select a method of payment.  When we receive your payment your registration will be confirmed.</font>');
	echo( form_close() );
?>
	
	<div class="form-button-container">
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/make_payment.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" /></a>
	</div>

</div>

<script type="text/javascript">
	function validate()
	{
		var eventid =  "<?php echo $eventid ?>";
		new Ajax.Request(baseUrl + 'validation/swamivisits_validation/validate_registration/'+eventid, 
		{
			method:'post',
			parameters: Form.serialize( $('registerEventForm1') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('registerEventForm1').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(response){var result = response.responseText; $('validationErrors').innerHTML = result;
					$('validationErrors').show();alert('failed') }
		});
	}

	function numParticipantsHandler()
	{
		var nump = $('numreg').options[$('numreg').selectedIndex].value;
		var divtot = document.getElementById('totamount');
		divtot.innerHTML = 5 * nump;
	}
</script>
